from django.db import models
from goods.models import Table

# Create your models here.


class Tables(models.Model):
    name = models.CharField(max_length=255, verbose_name='口味')

    class Meta:
        db_table = 'tables'
        verbose_name_plural = '口味'

    def __str__(self):
        return self.name


# 口味菜品关系表
class Dishes_Taste(models.Model):
    taste = models.ForeignKey(Tables, on_delete=models.CASCADE, verbose_name='口味ID')
    dishes = models.ForeignKey(Table, on_delete=models.CASCADE, verbose_name='菜品ID')
    desc_name = models.CharField(max_length=15, verbose_name='具体口味')

    class Meta:
        db_table = 'dishes_taste'
        verbose_name_plural = '具体口味'

    def __str__(self):
        return self.desc_name
